package com.nkzy.mapper;

import com.nkzy.pojo.Bigevent;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BigeventMapper {

    @Insert("INSERT INTO bigevent(title, content, start_time, end_time, location, status, create_time, update_time) " +
            "VALUES(#{title}, #{content}, #{startTime}, #{endTime}, #{location}, #{status}, #{createTime}, #{updateTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(Bigevent bigevent);

    @Select("SELECT * FROM bigevent WHERE id = #{id}")
    Bigevent selectById(Integer id);

    @Update("UPDATE bigevent SET title = #{title}, content = #{content}, start_time = #{startTime}, " +
            "end_time = #{endTime}, location = #{location}, status = #{status}, update_time = #{updateTime} " +
            "WHERE id = #{id}")
    void update(Bigevent bigevent);

    @Delete("DELETE FROM bigevent WHERE id = #{id}")
    void deleteById(Integer id);

    @Select("SELECT * FROM bigevent")
    List<Bigevent> selectAll();
}

